import steer
import vector


class Seek (steer.Steer):
    
    def __init__(self):
        steer.Steer.__init__(self)
    
    def calculate(self, targetPosition):
        vectorToTarget = targetPosition.subtract(self.position);
        if (vectorToTarget.length() != 0):
            desiredVelocity = ((vectorToTarget).normalize()).multiple(self.max_speed)
            # F = ( (V1 - V2).cutTo(maxV) * mass * czasJednostkowy ).cutTo(maxF)
            return desiredVelocity.subtract(self.velocity).cutTo(self.max_speed).multiple(self.mass).cutTo(self.max_force)
        else:
            return vector.Vector(0.0,0.0) 
        